import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import store from './store/index'
import {Provider} from 'react-redux'
import 'antd/dist/antd.min.css'; 
import './assets/css/reset.css'
import {BrowserRouter} from 'react-router-dom'
// 进入页面获取本地漱存储的数据是否存在,如果有,获取user存到store仓库里去
const user = localStorage.getItem('user')
if(user){
  const data = JSON.parse(user)
  //存到store仓库里面去
  store.dispatch({type:'setuser',payload:data})
}
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
    <BrowserRouter>
    <Provider store={store}>
      <App />
      </Provider>
    </BrowserRouter>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
